package edu.yuhf.web.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import edu.yuhf.domain.Hobby;
import edu.yuhf.service.iface.HobbyService;

@Controller
public class HobbyController {
	
	private static Logger log=Logger.getLogger(HobbyController.class);

	@Resource
	HobbyService hobbyService;
	
	@ResponseBody
	@RequestMapping(value="/hobbyInit",produces="application/json;charset=utf-8")
	public Map<String,Object> initHobby(HttpServletResponse response){
		Map<String,Object> map=new HashMap<String,Object>();
		List<Hobby> list=hobbyService.hobbyShow();
		if(list.size()!=0) {
			map.put("result", "success");
			map.put("list",list);
		}
		//String jsonString=JSON.toJSONString(map);
		//log.debug(jsonString);
		return map;
	}
}